<?php



namespace App\Http\Requests\ApiV2;

class ConquerBgImageRequest extends BaseRequest
{
    public function rules()
    {
        return [
            'file' => 'required|image|max:1024',
            'conquer_id' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'conquer_id.required' => __('请检查conquerId'),
            'file.required' => __('请上传文件'),
            'file.image' => __('请上传图片文件'),
            'file.max' => __('文件不能超过:size', ['size' => '3M']),
        ];
    }

    public function filldata()
    {
        $prefix ='conquer/'.date("Ymd");
        $result = save_image_single($this->file('file'),$prefix,'bg');
        return [
            'conquer_id'=>(int)$this->input('conquer_id'),
             'url'=>$result['url']

        ];

    }
}
